﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="Inventory.aspx.cs" Inherits="DevExpressWebApplication1.Module.MM.Inventory" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function LoadStockByType() {
            gvInventory.PerformCallback(cbbStock.GetValue());
        }
    </script>

    <div class="span10">
        <table width="100%">
            <tr>
                <td class="Tdlbl">Kho hàng</td>
                <td class="TdValue">
                    <dx:ASPxComboBox ID="cbbStock" runat="server" ClientIDMode="AutoID" DataSourceID="dsStock"
                        IncrementalFilteringMode="Contains" LoadingPanelImagePosition="Top" ShowShadow="False"
                        TextField="stock_name" ValueField="stock_id" ValueType="System.Int32"
                        ClientInstanceName="cbbStock" Width="100%" TabIndex="4" Theme="DevEx">
                        <ButtonStyle BackColor="Transparent">
                            <Paddings Padding="0px" />
                            <BackgroundImage ImageUrl="0" />
                            <Border BorderStyle="None" />
                        </ButtonStyle>
                        <ClientSideEvents ValueChanged="function(s,e){ LoadStockByType();}" />
                    </dx:ASPxComboBox>
                    <asp:SqlDataSource ID="dsStock" runat="server" ConnectionString="<%$ ConnectionStrings:PPL_ERPConnectionString %>" SelectCommand="sp_Stock_CMBSelectByStockType" SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:Parameter DefaultValue="san_pham" Name="StockTypeCode" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
        </table>
    </div>
    <div class="span10" style="margin-top: 10px">
        <dx:ASPxGridView ID="gvInventory" ClientInstanceName="gvInventory" ClientIDMode="Static" DataSourceID="dsInventory" OnCustomCallback="gvInventory_CustomCallback"
            Width="100%" runat="server" KeyFieldName="inventory_id" AutoGenerateColumns="False" Theme="DevEx">
            <%-- <Columns>
                <dx:GridViewDataTextColumn FieldName="supplier_name" VisibleIndex="1">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="company" VisibleIndex="2">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="phone" VisibleIndex="3">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="address" VisibleIndex="4">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataDateColumn FieldName="dob" VisibleIndex="5">
                </dx:GridViewDataDateColumn>
                <dx:GridViewDataTextColumn FieldName="group_name" VisibleIndex="6">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="group_id" Visible="False" ReadOnly="True" VisibleIndex="7">
                    <EditFormSettings Visible="False" />
                </dx:GridViewDataTextColumn>
            </Columns>--%>
            <Columns>
                <dx:GridViewDataTextColumn FieldName="inventory_id" VisibleIndex="0" Visible="false">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="product_id" VisibleIndex="1" Visible="false">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="stock_id" VisibleIndex="2" Visible="false">
                </dx:GridViewDataTextColumn>

                <dx:GridViewDataDateColumn FieldName="updateby" VisibleIndex="4" Visible="false">
                </dx:GridViewDataDateColumn>
                <dx:GridViewDataDateColumn FieldName="dateupdate" VisibleIndex="5"  Visible="false">
                </dx:GridViewDataDateColumn>
                <dx:GridViewDataTextColumn FieldName="stock_name" VisibleIndex="3">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="product_name" VisibleIndex="4">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="quantity" VisibleIndex="5">
                </dx:GridViewDataTextColumn>
            </Columns>
            <SettingsBehavior AllowFocusedRow="True" />
        </dx:ASPxGridView>
    </div>
    <asp:SqlDataSource ID="dsInventory" runat="server" ConnectionString="<%$ ConnectionStrings:PPL_ERPConnectionString %>" SelectCommand="sp_Inventory_GetByStockID" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:Parameter DefaultValue="-1" Name="StockID" />
        </SelectParameters>
    </asp:SqlDataSource>


</asp:Content>
